function dianji(fn) {
	//多次点击的问题
	let {
		onoff
	} = getApp().globalData;

	if (onoff) {
		getApp().globalData.onoff = false;
		fn();
		setTimeout(function() {
			getApp().globalData.onoff = true;
		}, 1500)
	} else {
		//如果一直走else分支可能是你没有在页面的data下面挂载onoff:true,不然一直都会走else
		console.log("请稍后点击")
	}
}

function Covering(num) {
	return num >= 10 ? num : '0' + num
}

function fomartDate(date) {
	let ms = new Date(date * 1000);
	var y = ms.getFullYear()
	var m = ms.getMonth() + 1
	var d = ms.getDate()
	var H = ms.getHours()
	var M = ms.getMinutes()
	var S = ms.getSeconds()

	return y + '-' + Covering(m) + '-' + Covering(d) + ' ' + Covering(H) + ':' + Covering(M) + ':' + Covering(
		S)
}
function fixed(val){
	return Number(val).toFixed(2)
}
function formatRichText(html) {
				let newContent = html.replace(/<img[^>]*>/gi, function(match, capture) {
					match = match.replace(/style="[^"]+"/gi, '').replace(/style='[^']+'/gi, '');
					match = match.replace(/width="[^"]+"/gi, '').replace(/width='[^']+'/gi, '');
					match = match.replace(/height="[^"]+"/gi, '').replace(/height='[^']+'/gi, '');
					return match;
				});
				newContent = newContent.replace(/style="[^"]+"/gi, function(match, capture) {
					match = match.replace(/width:[^;]+;/gi, 'max-width:100%;').replace(/width:[^;]+;/gi,
						'max-width:100%;');
					return match;
				});
				newContent = newContent.replace(/<br[^>]*\/>/gi, '');
				newContent = newContent.replace(/\<img/gi,
					'<img style="width:100%;height:auto;object-fit:fill;padding:0;margin:0;display:flex;"');
				return newContent;
			}
export {
	dianji,
	fomartDate,
	fixed,
	formatRichText
}
